package com.baor.controller;


import com.baor.domain.OrganizationVO;
import com.baor.service.OrganizationService;
import com.baor.util.R;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;

import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;

@RestController
@RequestMapping(value = "/organization")
public class OrganizationController {
    @Autowired
    private OrganizationService organizationService;
    @RequestMapping(value = "/organizationList")
    public R getOrganizationTree() {
        return organizationService.getOrganizationTree();
    }
    @RequestMapping(value = "/update")
    public R update(@RequestBody OrganizationVO organizationVO) {
        int row = this.organizationService.update(organizationVO);
        return row > 0 ? R.ok() : R.er() ;

    }
    @RequestMapping(value = "/insert")
    public R insert(@RequestBody OrganizationVO organizationVO) {
        int row = this.organizationService.insert(organizationVO);
        return row > 0 ? R.ok() : R.er() ;

    }
}
